#include "pch.h"
#include "enum_convert_dx9.h"
#include "D3DHeader.h"

using namespace Graphic;

int CB_To_Clear_DX9( int Buffers )
{
	int result = 0;
	if(Buffers & CB_CBUFFER)
	{
		result |= D3DCLEAR_TARGET;
	}
	if(Buffers & CB_ZBUFFER)
	{
		result |= D3DCLEAR_ZBUFFER;
	}

	if(Buffers & CB_SBUFFER)
	{
		result |= D3DCLEAR_STENCIL;
	}
	return result;
}

int BU_To_BufferLock_DX9( int Usage )
{
	switch(Usage)
	{
	
	case BU_READ_ONLY:
		return D3DLOCK_READONLY;
	default:
	case BU_READ_WRITE:
	case BU_WRITE_ONLY:
		return 0;
	}
}

int BU_To_BufferCreate_DX9( int Usage )
{
	switch(Usage)
	{

	case BU_READ_ONLY:
	case BU_READ_WRITE:
		return D3DUSAGE_DYNAMIC;
	default:
	case BU_WRITE_ONLY:
		return D3DUSAGE_WRITEONLY;
	}
}


	